home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / procps.preinst < prev    next >
Text File  |  2008-10-27  |  2KB  |  73 lines

  1. #!/bin/sh
  2. # preinst script for procps
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <new-preinst> `install'
  10. #        * <new-preinst> `install' <old-version>
  11. #        * <new-preinst> `upgrade' <old-version>
  12. #        * <old-preinst> `abort-upgrade' <new-version>
  13. # for details, see http://www.debian.org/doc/debian-policy/ or
  14. # the debian-policy package
  15.  
  16. prep_mv_conffile()
  17. {
  18.   PKGNAME=$1
  19.   CONFFILE=$2
  20.  
  21.   if [ -e "$CONFFILE" ]; then
  22.     md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  23.     old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  24.     if [ "$md5sum" = "$old_md5sum" ]; then
  25.       rm -f "$CONFFILE"
  26.     fi
  27.   fi
  28. }
  29.  
  30. upgradeoldconffile()
  31. {
  32.   f=/etc/init.d/procps.sh
  33.   [ ! -e "$f" ] && return
  34.  
  35.   curmd5=`md5sum "$f" |awk '{print $1}'`
  36.   oldmd5=`dpkg-query -W -f='${Conffiles}' procps | sed "{\\'^ $f ' ! d; s///}"`
  37.   [ "$curmd5" = "$oldmd5" ] && {
  38.       # The admin has not modified $f
  39.       echo "Preparing to remove obsolete, unmodified conffile: $f"
  40.       mv -fv "$f" "$f.from-preinst"
  41.       return
  42.     } >&2
  43.  
  44.     # The admim modified $f; cause a deliberate conffile prompt
  45.     echo "Moving obsolete conffile to new pathname:"
  46.     mv -fv "$f" "${f%.sh}"
  47. }
  48.  
  49.  
  50. case "$1" in
  51.     install)
  52.     ;;
  53.     upgrade)
  54.       prep_mv_conffile procps "/etc/init.d/procps.sh"
  55.     ;;
  56.     abort-upgrade)
  57.     ;;
  58.  
  59.     *)
  60.         echo "preinst called with unknown argument \`$1'" >&2
  61.         exit 1
  62.     ;;
  63. esac
  64.  
  65. # dh_installdeb will replace this with shell code automatically
  66. # generated by other debhelper scripts.
  67.  
  68.  
  69.  
  70. exit 0
  71.  
  72.  
  73.